<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018/9/29
  Time: 16:59
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%
    String path = request.getContextPath();
    request.setAttribute("path", path);
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<html>
<head>
    <title>login</title>
    <script type="text/javascript" src="${path }/resource/jquery.min.js"></script>
</head>
<body>
    账号<input type="text" id="userName">
    密码<input type="text" id="password">
    <input type = "button" id = "saveBtn" value = "注册"/>
</body>
</html>
<script type="text/javascript">
        $("#saveBtn") .click(function(){
            var userName = $("#userName").val();
            $.ajax({
                url:'${path}/user/zhuce',
                data:{"userName":$("#userName").val(),"password":$("#password").val()},
                type:'post',
                dataType:'json',
                success:function(data){
                    if(data.state){
                        window.location.href = "${path}/module/login.jsp?userName="+userName;
                    }else{
                        alert(data.message);
                    }
                }
            });
        });
</script>
